/**
 * OSS is a Open Service Container which gives the leverage of building the Desktop and Web
 * Application. * Copyright (C) 2008-2009  Ponraj Sutanthiramani
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Or5e Open Source Community
 * 105, S.S Paradise Apartment, Munnireddy Layout, Horamavu, Banaswadi, Bangalore, India.
 */
package org.or5e.core;

import java.io.File;
import java.util.LinkedList;
import java.util.List;

/**
 *
 * @author Ponraj Suthanthiramani
 */
public abstract class FileLoader extends BaseObject{

    private File loadFile;
    private String type;

    public File getLoadFile() {
        return loadFile;
    }

    public void setLoadFile(File loadFile) {
        this.loadFile = loadFile;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public<T> List<T> loadEntry(T obj) {
        initilize();
        List<T> loadEntry = new LinkedList();
        T entry = (T) getNextEntry();
        while (entry != null) {
            loadEntry.add(entry);
            entry = (T) getNextEntry();
        }
        return loadEntry;
    }
    public abstract void  initilize();
    public abstract Object getNextEntry();
}